public class DAY0417 {
    //剑指 Offer 10- II. 青蛙跳台阶问题
    public int numWays(int n) {
        if (n == 0 || n == 1) {
            return 1;
        }

        int one = 1, two = 1;
        for (int i = 1; i < n; i++) {
            int tmp = (one + two) % 1000000007;
            one = two;
            two = tmp;
        }
        return two;
    }

    //剑指 Offer 11. 旋转数组的最小数字
    public int minArray(int[] numbers) {
        int low = 0;
        int high = numbers.length - 1;
        while (low < high) {
            int pivot = low + (high - low) / 2;
            if (numbers[pivot] < numbers[high]) {
                high = pivot;
            } else if (numbers[pivot] > numbers[high]) {
                low = pivot + 1;
            } else {
                high -= 1;
            }
        }
        return numbers[low];
    }
}
